package com.huike.web.controller.business;

import com.huike.business.domain.BusinessTrackRecordDto;
import java.util.List;

import com.huike.business.domain.vo.TbBusinessKeys;
import com.huike.clues.service.ISysDictDataService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.domain.vo.BusinessTrackVo;
import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.business.service.impl.TbBusinessTrackRecordServiceImpl;
import com.huike.common.core.domain.AjaxResult;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huike.common.core.controller.BaseController;

import java.util.List;

/**
 * 商机跟进记录Controller
 * @date 2021-04-28
 */
@RestController
@RequestMapping("/business/record")
public class TbBusinessTrackRecordController extends BaseController {

    @Autowired
    private ITbBusinessTrackRecordService tbBusinessTrackRecordService;

    @Autowired
    private ISysDictDataService sysDictDataService;

    @Autowired
    private ITbBusinessTrackRecordService iTbBusinessTrackRecordService;

    /**
     * 查询商机跟进记录列表
     */
    @PreAuthorize("@ss.hasPermi('business:record:list')")
    @GetMapping("/list")
    public  AjaxResult list(@RequestParam("businessId")Long id){

        List<TbBusinessTrackRecord> result = tbBusinessTrackRecordService.findByliebiao(id);
        return AjaxResult.success(result);
    }

    /**
     * 新增商机跟进记录
     * @return
     */
    @PostMapping
    public AjaxResult save(@RequestBody BusinessTrackVo businessTrackVo) {
        iTbBusinessTrackRecordService.save(businessTrackVo);
        return AjaxResult.success("新增商机跟进记录成功！");
    }

    /**
     * 商机跟进记录列表
     * @param businessId
     * @return
     */
    // @GetMapping("/list")
    // public AjaxResult list(Long businessId) {
    //     List<BusinessTrackRecordDto> businessTrackRecordDtos = iTbBusinessTrackRecordService.list(businessId);
    //     return AjaxResult.success(businessTrackRecordDtos);
    // }

}
